Conditions | 1 |
Paths | 1 |
Total Lines | 51 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | /* |
||
51 | $(document).ready(function () { |
||
52 | |||
53 | /** |
||
54 | * @constructs CMSPico |
||
55 | */ |
||
56 | var CMSPico = function () { |
||
57 | |||
58 | $.extend(CMSPico.prototype, pico_nav); |
||
59 | $.extend(CMSPico.prototype, pico_elements); |
||
60 | $.extend(CMSPico.prototype, pico_result); |
||
61 | |||
62 | pico_define.init(); |
||
63 | pico_elements.init(); |
||
64 | |||
65 | pico_nav.retrieveWebsites(); |
||
66 | }; |
||
67 | |||
68 | /** |
||
69 | * @constructs Notification |
||
70 | */ |
||
71 | var Notification = function () { |
||
72 | this.initialize(); |
||
73 | }; |
||
74 | |||
75 | Notification.prototype = { |
||
76 | |||
77 | initialize: function () { |
||
78 | |||
79 | var notyf = new Notyf({ |
||
80 | delay: 5000 |
||
81 | }); |
||
82 | |||
83 | this.onSuccess = function (text) { |
||
84 | notyf.confirm(text); |
||
85 | }; |
||
86 | |||
87 | this.onFail = function (text) { |
||
88 | notyf.alert(text); |
||
89 | }; |
||
90 | |||
91 | } |
||
92 | |||
93 | }; |
||
94 | |||
95 | OCA.CMSPico = CMSPico; |
||
96 | OCA.CMSPico.manage = new CMSPico(); |
||
97 | |||
98 | OCA.Notification = Notification; |
||
99 | OCA.notification = new Notification(); |
||
100 | |||
101 | }); |
||
102 |